home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / plugin / nsplugindefs.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  13KB  |  397 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  26.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #ifndef nsplugindefs_h___
  39. #define nsplugindefs_h___
  40.  
  41. #if defined(XP_OS2) || defined(__OS2__)
  42. #define INCL_BASE
  43. #define INCL_PM
  44. #include <os2.h>
  45. #pragma pack(1)
  46. #endif
  47.  
  48. #ifndef prtypes_h___
  49. #include "prtypes.h"
  50. #endif
  51.  
  52. #if defined(XP_MAC) || defined(XP_MACOSX)
  53. #   include <Quickdraw.h>
  54. #   include <Events.h>
  55. #   include <MacWindows.h>
  56. #endif
  57.  
  58. #if defined(XP_UNIX) && defined(MOZ_X11)
  59. #   include <X11/Xlib.h>
  60. #   include <X11/Xutil.h>
  61. #endif
  62.  
  63. #if defined(XP_WIN)
  64. #   include <windef.h>
  65. #endif
  66.  
  67. ////////////////////////////////////////////////////////////////////////////////
  68.  
  69. /* The OS/2 version of Netscape uses RC_DATA to define the
  70.    mime types, file extensions, etc that are required.
  71.    Use a vertical bar to separate types, end types with \0.
  72.    FileVersion and ProductVersion are 32bit ints, all other
  73.    entries are strings the MUST be terminated wwith a \0.
  74.  
  75. AN EXAMPLE:
  76.  
  77. RCDATA NS_INFO_ProductVersion { 1,0,0,1,}
  78.  
  79. RCDATA NS_INFO_MIMEType    { "video/x-video|",
  80.                              "video/x-flick\0" }
  81. RCDATA NS_INFO_FileExtents { "avi|",
  82.                              "flc\0" }
  83. RCDATA NS_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
  84.                              "MMOS2 Flc/Fli player(*.flc)\0" }
  85.  
  86. RCDATA NS_INFO_FileVersion       { 1,0,0,1 }
  87. RCDATA NS_INFO_CompanyName       { "Netscape Communications\0" }
  88. RCDATA NS_INFO_FileDescription   { "NPAVI32 Extension DLL\0"
  89. RCDATA NS_INFO_InternalName      { "NPAVI32\0" )
  90. RCDATA NS_INFO_LegalCopyright    { "Copyright Netscape Communications \251 1996\0"
  91. RCDATA NS_INFO_OriginalFilename  { "NVAPI32.DLL" }
  92. RCDATA NS_INFO_ProductName       { "NPAVI32 Dynamic Link Library\0" }
  93.  
  94. */
  95.  
  96.  
  97. /* RC_DATA types for version info - required */
  98. #define NS_INFO_ProductVersion      1
  99. #define NS_INFO_MIMEType            2
  100. #define NS_INFO_FileOpenName        3
  101. #define NS_INFO_FileExtents         4
  102.  
  103. /* RC_DATA types for version info - used if found */
  104. #define NS_INFO_FileDescription     5
  105. #define NS_INFO_ProductName         6
  106.  
  107. /* RC_DATA types for version info - optional */
  108. #define NS_INFO_CompanyName         7
  109. #define NS_INFO_FileVersion         8
  110. #define NS_INFO_InternalName        9
  111. #define NS_INFO_LegalCopyright      10
  112. #define NS_INFO_OriginalFilename    11
  113.  
  114. #ifndef RC_INVOKED
  115.  
  116. ////////////////////////////////////////////////////////////////////////////////
  117. // Structures and definitions
  118.  
  119. #ifdef XP_MAC
  120. #pragma options align=mac68k
  121. #endif
  122.  
  123. typedef const char*     nsMIMEType;
  124.  
  125. struct nsByteRange {
  126.     PRInt32             offset;     /* negative offset means from the end */
  127.     PRUint32            length;
  128.     struct nsByteRange* next;
  129. };
  130.  
  131. struct nsPluginRect {
  132.     PRUint16            top;
  133.     PRUint16            left;
  134.     PRUint16            bottom;
  135.     PRUint16            right;
  136. };
  137.  
  138. ////////////////////////////////////////////////////////////////////////////////
  139. // Unix specific structures and definitions
  140.  
  141. #ifdef XP_UNIX
  142.  
  143. #include <stdio.h>
  144.  
  145. /*
  146.  * Callback Structures.
  147.  *
  148.  * These are used to pass additional platform specific information.
  149.  */
  150. enum nsPluginCallbackType {
  151.     nsPluginCallbackType_SetWindow = 1,
  152.     nsPluginCallbackType_Print
  153. };
  154.  
  155. struct nsPluginAnyCallbackStruct {
  156.     PRInt32     type;
  157. };
  158.  
  159. #ifdef MOZ_X11
  160. struct nsPluginSetWindowCallbackStruct {
  161.     PRInt32     type;
  162.     Display*    display;
  163.     Visual*     visual;
  164.     Colormap    colormap;
  165.     PRUint32    depth;
  166. };
  167. #else
  168. struct nsPluginSetWindowCallbackStruct {
  169.     PRInt32     type;
  170. };
  171. #endif
  172.  
  173.  
  174. struct nsPluginPrintCallbackStruct {
  175.     PRInt32     type;
  176.     FILE*       fp;
  177. };
  178.  
  179. #endif /* XP_UNIX */
  180.  
  181. ////////////////////////////////////////////////////////////////////////////////
  182.  
  183. // List of variables which should be implmented by the plugin
  184. enum nsPluginVariable {
  185.     nsPluginVariable_NameString                      = 1,
  186.     nsPluginVariable_DescriptionString               = 2
  187. };
  188.  
  189. enum nsPluginManagerVariable {
  190.     nsPluginManagerVariable_XDisplay                 = 1,
  191.     nsPluginManagerVariable_XtAppContext             = 2,
  192.     nsPluginManagerVariable_SupportsXEmbed            = 14
  193. };
  194.  
  195. enum nsPluginInstancePeerVariable {
  196.     nsPluginInstancePeerVariable_NetscapeWindow      = 3
  197. //    nsPluginInstancePeerVariable_JavaClass              = 5,
  198. //    nsPluginInstancePeerVariable_TimerInterval          = 7
  199. };
  200.  
  201. enum nsPluginInstanceVariable {
  202.     nsPluginInstanceVariable_WindowlessBool          = 3,
  203.     nsPluginInstanceVariable_TransparentBool         = 4,
  204.     nsPluginInstanceVariable_DoCacheBool             = 5,
  205.     nsPluginInstanceVariable_CallSetWindowAfterDestroyBool = 6,
  206.     nsPluginInstanceVariable_ScriptableInstance      = 10,
  207.     nsPluginInstanceVariable_ScriptableIID           = 11,
  208.     nsPluginInstanceVariable_NeedsXEmbed             = 14
  209. };
  210.  
  211. ////////////////////////////////////////////////////////////////////////////////
  212.  
  213. enum nsPluginMode {
  214.     nsPluginMode_Embedded = 1,
  215.     nsPluginMode_Full
  216. };
  217.  
  218. // XXX this can go away now
  219. enum nsPluginStreamType {
  220.     nsPluginStreamType_Normal = 1,
  221.     nsPluginStreamType_Seek,
  222.     nsPluginStreamType_AsFile,
  223.     nsPluginStreamType_AsFileOnly
  224. };
  225.  
  226. /*
  227.  * The type of a nsPluginWindow - it specifies the type of the data structure
  228.  * returned in the window field.
  229.  */
  230. enum nsPluginWindowType {
  231.     nsPluginWindowType_Window = 1,
  232.     nsPluginWindowType_Drawable
  233. };
  234.  
  235. #if defined(XP_MAC) || defined(XP_MACOSX)
  236.  
  237. struct nsPluginPort {
  238.     CGrafPtr     port;   /* Grafport */
  239.     PRInt32     portx;  /* position inside the topmost window */
  240.     PRInt32     porty;
  241. };
  242. typedef RgnHandle       nsPluginRegion;
  243. typedef WindowRef       nsPluginPlatformWindowRef;
  244.  
  245. #elif defined(XP_WIN) || defined(XP_OS2)
  246.  
  247. struct nsPluginPort;
  248. typedef HRGN            nsPluginRegion;
  249. typedef HWND            nsPluginPlatformWindowRef;
  250.  
  251. #elif defined(XP_UNIX) && defined(MOZ_X11)
  252.  
  253. struct nsPluginPort;
  254. typedef Region          nsPluginRegion;
  255. typedef Drawable        nsPluginPlatformWindowRef;
  256.  
  257. #else
  258.  
  259. struct nsPluginPort;
  260. typedef void*           nsPluginRegion;
  261. typedef void*           nsPluginPlatformWindowRef;
  262.  
  263. #endif
  264.  
  265. struct nsPluginWindow {
  266.     nsPluginPort* window;       /* Platform specific window handle */
  267.                                 /* OS/2: x - Position of bottom left corner  */
  268.                                 /* OS/2: y - relative to visible netscape window */
  269.     PRInt32       x;            /* Position of top left corner relative */
  270.     PRInt32       y;            /*    to a netscape page.                    */
  271.     PRUint32      width;        /* Maximum window size */
  272.     PRUint32      height;
  273.     nsPluginRect  clipRect;     /* Clipping rectangle in port coordinates */
  274.                                 /* Used by MAC only.              */
  275. #if defined(XP_UNIX) && !defined(XP_MACOSX)
  276.     void*         ws_info;      /* Platform-dependent additonal data */
  277. #endif /* XP_UNIX */
  278.     nsPluginWindowType type;    /* Is this a window or a drawable? */
  279. };
  280.  
  281. struct nsPluginFullPrint {
  282.     PRBool      pluginPrinted;    /* Set TRUE if plugin handled fullscreen */
  283.                                 /*    printing                             */
  284.     PRBool      printOne;       /* TRUE if plugin should print one copy  */
  285.                                 /*    to default printer                     */
  286.     void*       platformPrint;  /* Platform-specific printing info */
  287. };
  288.  
  289. struct nsPluginEmbedPrint {
  290.     nsPluginWindow    window;
  291.     void*             platformPrint;    /* Platform-specific printing info */
  292. };
  293.  
  294. struct nsPluginPrint {
  295.     PRUint16                  mode;         /* nsPluginMode_Full or nsPluginMode_Embedded */
  296.     union
  297.     {
  298.         nsPluginFullPrint     fullPrint;    /* if mode is nsPluginMode_Full */
  299.         nsPluginEmbedPrint    embedPrint;    /* if mode is nsPluginMode_Embedded */
  300.     } print;
  301. };
  302.  
  303. struct nsPluginEvent {
  304.  
  305. #if defined(XP_MAC) || defined(XP_MACOSX)
  306.     EventRecord*                event;
  307.     nsPluginPlatformWindowRef   window;
  308.  
  309. #elif defined(XP_OS2)
  310.     uint32      event;
  311.     uint32      wParam;
  312.     uint32      lParam;
  313.  
  314. #elif defined(XP_WIN)
  315.     uint16      event;
  316.     uint32      wParam;
  317.     uint32      lParam;
  318.  
  319. #elif defined(XP_UNIX) && defined(MOZ_X11)
  320.     XEvent      event;
  321. #else
  322.     void        *event;
  323. #endif
  324. };
  325.  
  326. /*
  327.  *  Non-standard event types that can be passed to HandleEvent
  328.  *  (These need to be kept in sync with the events defined in npapi.h.)
  329.  */
  330. enum nsPluginEventType {
  331. #if defined(XP_MAC) || defined(XP_MACOSX)
  332.     nsPluginEventType_GetFocusEvent = (osEvt + 16),
  333.     nsPluginEventType_LoseFocusEvent,
  334.     nsPluginEventType_AdjustCursorEvent,
  335.     nsPluginEventType_MenuCommandEvent,
  336.     nsPluginEventType_ClippingChangedEvent,
  337.     nsPluginEventType_ScrollingBeginsEvent,
  338.     nsPluginEventType_ScrollingEndsEvent,
  339. #endif /* XP_MAC || XP_MACOSX */
  340.     nsPluginEventType_Idle                 = 0
  341. };
  342.  
  343. ////////////////////////////////////////////////////////////////////////////////
  344.  
  345. enum nsPluginReason {
  346.     nsPluginReason_Base = 0,
  347.     nsPluginReason_Done = 0,
  348.     nsPluginReason_NetworkErr,
  349.     nsPluginReason_UserBreak,
  350.     nsPluginReason_NoReason
  351. };
  352.  
  353. ////////////////////////////////////////////////////////////////////////////////
  354. // Version Numbers for Structs
  355.  
  356. // These version number are for structures whose fields may evolve over time.
  357. // When fields are added to the end of the struct, the minor version will be
  358. // incremented. When the struct changes in an incompatible way the major version
  359. // will be incremented. 
  360.  
  361. #define nsMajorVersion(v)       (((PRInt32)(v) >> 16) & 0xffff)
  362. #define nsMinorVersion(v)       ((PRInt32)(v) & 0xffff)
  363.  
  364. #define nsVersionOK(suppliedV, requiredV)                   \
  365.     (nsMajorVersion(suppliedV) == nsMajorVersion(requiredV) \
  366.      && nsMinorVersion(suppliedV) >= nsMinorVersion(requiredV))
  367.  
  368. #define NP_POPUP_API_VERSION 16
  369.  
  370. ////////////////////////////////////////////////////////////////////////////////
  371. // Classes
  372. ////////////////////////////////////////////////////////////////////////////////
  373.  
  374. // Classes that must be implemented by the plugin DLL:
  375. class nsIPlugin;                        // plugin class (MIME-type handler)
  376. class nsIEventHandler;                  // event handler interface
  377. class nsIPluginInstance;                // plugin instance
  378.  
  379. // Classes that are implemented by the browser:
  380. class nsIPluginManager;                 // minimum browser requirements
  381. class nsIFileUtilities;                 // file utilities (accessible from nsIPluginManager)
  382. class nsIPluginInstancePeer;            // parts of nsIPluginInstance implemented by the browser
  383. class nsIWindowlessPluginInstancePeer;  // subclass of nsIPluginInstancePeer for windowless plugins
  384. class nsIPluginTagInfo;                 // describes html tag (accessible from nsIPluginInstancePeer)
  385. ////////////////////////////////////////////////////////////////////////////////
  386.  
  387. #ifdef XP_MAC
  388. #pragma options align=reset
  389. #endif
  390.  
  391. #endif /* RC_INVOKED */
  392. #ifdef __OS2__
  393. #pragma pack()
  394. #endif
  395.  
  396. #endif // nsplugindefs_h___
  397.